﻿<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="code"/>
  <xsl:param name="wx_icon_path">/SiteCollectionImages/WeatherImages/</xsl:param>

  <xsl:template match="/data">
    <xsl:apply-templates select="weather/countries/country/location"/>
    <xsl:apply-templates select="weather/countries/country/location/forecasts"/>
  </xsl:template>
  <xsl:template match="weather/countries/country/location">
    <br />
    <b style="color:#999999;">
      <xsl:value-of select="@name"/>
    </b>
    <br />
  </xsl:template>
  <xsl:template match="weather/countries/country/location/forecasts">
    <table cellspacing="0" border="0">
      <tr>
        <xsl:for-each select="forecast">
          <td>
            <table border="0" cellspacing="7">
              <tr>
                <td>
                  <xsl:value-of select="day_name"/>
                </td>
              </tr>
              <tr>
                <td>
                  <xsl:element name="img">
                    <xsl:attribute name="src">
                      <xsl:value-of select="concat( $wx_icon_path, normalize-space(translate( icon, ' ABCDEFGHIJKLMNOPQRSTUVWXYZ', '_abcdefghijklmnopqrstuvwxyz' ) ),
						          '.gif' )"/>
                    </xsl:attribute>
                    <xsl:attribute name="alt">
                      <xsl:value-of select="icon/@filename"/>
                    </xsl:attribute>
                  </xsl:element>
                </td>
              </tr>
              <tr>
                <td class="right">
                  <xsl:element name="span">
                    <xsl:attribute name="class">
                      <xsl:text>cold</xsl:text>
                    </xsl:attribute>
                    <xsl:value-of select="temp_min_c"/>
                    <xsl:value-of select="temp_min_c/@units"/>
                  </xsl:element>
                  -
                  <xsl:element name="span">
                    <xsl:attribute name="class">
                      <xsl:text>hot</xsl:text>
                    </xsl:attribute>
                    <xsl:value-of select="temp_max_c"/>
                    <xsl:value-of select="temp_max_c/@units"/>
                  </xsl:element>
                </td>
              </tr>
            </table>
          </td>
          <td width="2px">&#10;</td>
        </xsl:for-each>
      </tr>
    </table>
  </xsl:template>
</xsl:stylesheet>

